﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for ReportCredentials
/// </summary>
public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
{
    string strUserName, strPassword, strDomain;

    public ReportCredentials(string userName, string password, string domain)
    {
        strUserName = userName;
        strPassword = password;
        strDomain = domain;
    }

    public ReportCredentials()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    #region IReportServerCredentials Members

    public bool GetFormsCredentials(out System.Net.Cookie authCookie, out string userName, out string password, out string authority)
    {
        userName = strUserName;
        password = strPassword;
        authority = strDomain;
        authCookie = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain");
        return true;
    }

    public System.Security.Principal.WindowsIdentity ImpersonationUser
    {
        get
        {
            return null;
        }
    }

    public System.Net.ICredentials NetworkCredentials
    {
        get
        {
            return new System.Net.NetworkCredential(strUserName, strPassword, strDomain);
        }
    }
    #endregion
}
